

#include <stdio.h>
#include <stdlib.h>
#include "stack_base_list.h"

int  main(void)
{
    printf ("整数：");
    unsigned int numb;
    scanf ("%d", &numb);

    printf ("进制：");
    int base;
    scanf ("%d", &base);

                            
    STACK* stack = stack_create ();

    while(numb)
    {
        stack_push (stack, numb % base);
        numb /=base;
    } 

    printf ("结果：");
    while (! stack_empty (stack)) 
    {
        int digit = stack_pop (stack);
        if (digit < 10)
        {
            printf ("%d", digit);
        }
        else
        {
            printf ("%c", digit - 10 + 'A');
        }
    }
    
    printf ("\n");

    stack_destroy (stack);
    
    return 0;
}
